package com.practice.springboot.springbootMybatis.service;

import com.practice.springboot.springbootMybatis.mapper.BookMapper;
import com.practice.springboot.springbootMybatis.model.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author sai
 * @create 2020-08-23 3:40
 */
@Service
public class BookService {

    @Autowired
    BookMapper bookMapper ;

    public int insertBook( Book book ){
        return bookMapper.addBook(book) ;
    }

    public int updateBook(Book book){
        return bookMapper.updateBook(book) ;
    }

    public int deleteBook(long id){
        return bookMapper.deleteBook(id) ;
    }

    public Book queryBookById(Long id){
        return bookMapper.getBookById(id) ;
    }

    public List<Book> getAllBooks( ){
        return  bookMapper.getAllBooks() ;
    }


}
